package com.tristia.entity.util;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.tristia.entity.Good;
import com.tristia.service.GoodService;

public class GoodDataLoader {
	private List<Good> goods = new ArrayList<Good>();
	private GoodService goodService;
	
	public void loadData() {
		for (Good good : goods) {
			goodService.save(good);
		}
		goods.clear();
		goods = null;
	}

	public void setGoods(List<Good> goods) {
		this.goods = goods;
	}
	@Autowired
	public void setGoodService(GoodService goodService) {
		this.goodService = goodService;
	}
	
	public void init() {
		loadData();
	}
}
